-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access files as setuptools pkg_resource #2309
base: master
Are you sure you want to change the base?
Conversation
This looks great! Adding |
PR updated
|
setup.py
Outdated
@@ -51,7 +51,7 @@ | |||
}, | |||
packages=['safety_db'], | |||
license='Attribution-NonCommercial-ShareAlike 4.0 International', | |||
install_requires=[], | |||
install_requires=['install_requires'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
erm, setuptools
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...and 👍 for the quick response!
Hello! Is there something I can help with to get this PR merged? |
Not doing so causes nothing in the data directory to be included in the distribution.
Any reason why this has not merged yet? |
If I understand correctly stdlib's importlib.resources would be preferred over setuptools' pkg_resources, wouldn't they? |
Yep, wait a few more weeks on this until 3.6 is EOL and yeah, stdlib ftw! |
This is a updated fix for pyupio#2308 and supersedes pyupio#2309 It uses importlib.resources which means dropping support for python 3.6 and below
I've made a version of this PR which uses Let's get |
from
data/__init__.py
:That open is relative to your working directory, the reason it works for testing is that folder data is in the root of your package. The proper way to access this file is with
pkg_resources
from setuptools as aresource_filename
.